\(\int \frac {\cot ^2(x)}{\sqrt {a+a \tan ^2(x)}} \, dx\) [277]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 17, antiderivative size = 31 \[ \int \frac {\cot ^2(x)}{\sqrt {a+a \tan ^2(x)}} \, dx=-\frac {\csc (x) \sec (x)}{\sqrt {a \sec ^2(x)}}-\frac {\tan (x)}{\sqrt {a \sec ^2(x)}} \]

[Out]

-csc(x)*sec(x)/(a*sec(x)^2)^(1/2)-tan(x)/(a*sec(x)^2)^(1/2)

Rubi [A] (verified)

Time = 0.12 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.235, Rules used = {3738, 4210, 2670, 14} \[ \int \frac {\cot ^2(x)}{\sqrt {a+a \tan ^2(x)}} \, dx=-\frac {\csc (x) \sec (x)}{\sqrt {a \sec ^2(x)}}-\frac {\tan (x)}{\sqrt {a \sec ^2(x)}} \]

[In]

Int[Cot[x]^2/Sqrt[a + a*Tan[x]^2],x]

[Out]

-((Csc[x]*Sec[x])/Sqrt[a*Sec[x]^2]) - Tan[x]/Sqrt[a*Sec[x]^2]

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 2670

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[-f^(-1), Subst[Int[(1 - x^2
)^((m + n - 1)/2)/x^n, x], x, Cos[e + f*x]], x] /; FreeQ[{e, f}, x] && IntegersQ[m, n, (m + n - 1)/2]

Rule 3738

Int[(u_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> Int[ActivateTrig[u*(a*sec[e + f*x]^2)^p]
, x] /; FreeQ[{a, b, e, f, p}, x] && EqQ[a, b]

Rule 4210

Int[(u_.)*((b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_), x_Symbol] :> With[{ff = FreeFactors[Sec[e + f*x], x]}, Di
st[(b*ff^n)^IntPart[p]*((b*Sec[e + f*x]^n)^FracPart[p]/(Sec[e + f*x]/ff)^(n*FracPart[p])), Int[ActivateTrig[u]
*(Sec[e + f*x]/ff)^(n*p), x], x]] /; FreeQ[{b, e, f, n, p}, x] &&  !IntegerQ[p] && IntegerQ[n] && (EqQ[u, 1] |
| MatchQ[u, ((d_.)*(trig_)[e + f*x])^(m_.) /; FreeQ[{d, m}, x] && MemberQ[{sin, cos, tan, cot, sec, csc}, trig
]])

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cot ^2(x)}{\sqrt {a \sec ^2(x)}} \, dx \\ & = \frac {\sec (x) \int \cos (x) \cot ^2(x) \, dx}{\sqrt {a \sec ^2(x)}} \\ & = -\frac {\sec (x) \text {Subst}\left (\int \frac {1-x^2}{x^2} \, dx,x,-\sin (x)\right )}{\sqrt {a \sec ^2(x)}} \\ & = -\frac {\sec (x) \text {Subst}\left (\int \left (-1+\frac {1}{x^2}\right ) \, dx,x,-\sin (x)\right )}{\sqrt {a \sec ^2(x)}} \\ & = -\frac {\csc (x) \sec (x)}{\sqrt {a \sec ^2(x)}}-\frac {\tan (x)}{\sqrt {a \sec ^2(x)}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 22, normalized size of antiderivative = 0.71 \[ \int \frac {\cot ^2(x)}{\sqrt {a+a \tan ^2(x)}} \, dx=\frac {-\csc (x) \sec (x)-\tan (x)}{\sqrt {a \sec ^2(x)}} \]

[In]

Integrate[Cot[x]^2/Sqrt[a + a*Tan[x]^2],x]

[Out]

(-(Csc[x]*Sec[x]) - Tan[x])/Sqrt[a*Sec[x]^2]

Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.61

method result size
default \(\frac {\cot \left (x \right )-2 \sec \left (x \right ) \csc \left (x \right )}{\sqrt {a \sec \left (x \right )^{2}}}\) \(19\)
risch \(\frac {i \left ({\mathrm e}^{4 i x}-6 \,{\mathrm e}^{2 i x}+1\right )}{2 \sqrt {\frac {a \,{\mathrm e}^{2 i x}}{\left ({\mathrm e}^{2 i x}+1\right )^{2}}}\, \left ({\mathrm e}^{2 i x}+1\right ) \left ({\mathrm e}^{2 i x}-1\right )}\) \(54\)

[In]

int(cot(x)^2/(a+a*tan(x)^2)^(1/2),x,method=_RETURNVERBOSE)

[Out]

1/(a*sec(x)^2)^(1/2)*(cot(x)-2*sec(x)*csc(x))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.06 \[ \int \frac {\cot ^2(x)}{\sqrt {a+a \tan ^2(x)}} \, dx=-\frac {\sqrt {a \tan \left (x\right )^{2} + a} {\left (2 \, \tan \left (x\right )^{2} + 1\right )}}{a \tan \left (x\right )^{3} + a \tan \left (x\right )} \]

[In]

integrate(cot(x)^2/(a+a*tan(x)^2)^(1/2),x, algorithm="fricas")

[Out]

-sqrt(a*tan(x)^2 + a)*(2*tan(x)^2 + 1)/(a*tan(x)^3 + a*tan(x))

Sympy [F]

\[ \int \frac {\cot ^2(x)}{\sqrt {a+a \tan ^2(x)}} \, dx=\int \frac {\cot ^{2}{\left (x \right )}}{\sqrt {a \left (\tan ^{2}{\left (x \right )} + 1\right )}}\, dx \]

[In]

integrate(cot(x)**2/(a+a*tan(x)**2)**(1/2),x)

[Out]

Integral(cot(x)**2/sqrt(a*(tan(x)**2 + 1)), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 128 vs. \(2 (27) = 54\).

Time = 0.36 (sec) , antiderivative size = 128, normalized size of antiderivative = 4.13 \[ \int \frac {\cot ^2(x)}{\sqrt {a+a \tan ^2(x)}} \, dx=\frac {{\left ({\left (\sin \left (3 \, x\right ) - \sin \left (x\right )\right )} \cos \left (4 \, x\right ) - {\left (\cos \left (3 \, x\right ) - \cos \left (x\right )\right )} \sin \left (4 \, x\right ) - {\left (6 \, \cos \left (2 \, x\right ) - 1\right )} \sin \left (3 \, x\right ) + 6 \, \cos \left (3 \, x\right ) \sin \left (2 \, x\right ) - 6 \, \cos \left (x\right ) \sin \left (2 \, x\right ) + 6 \, \cos \left (2 \, x\right ) \sin \left (x\right ) - \sin \left (x\right )\right )} \sqrt {a}}{2 \, {\left (a \cos \left (3 \, x\right )^{2} - 2 \, a \cos \left (3 \, x\right ) \cos \left (x\right ) + a \cos \left (x\right )^{2} + a \sin \left (3 \, x\right )^{2} - 2 \, a \sin \left (3 \, x\right ) \sin \left (x\right ) + a \sin \left (x\right )^{2}\right )}} \]

[In]

integrate(cot(x)^2/(a+a*tan(x)^2)^(1/2),x, algorithm="maxima")

[Out]

1/2*((sin(3*x) - sin(x))*cos(4*x) - (cos(3*x) - cos(x))*sin(4*x) - (6*cos(2*x) - 1)*sin(3*x) + 6*cos(3*x)*sin(
2*x) - 6*cos(x)*sin(2*x) + 6*cos(2*x)*sin(x) - sin(x))*sqrt(a)/(a*cos(3*x)^2 - 2*a*cos(3*x)*cos(x) + a*cos(x)^
2 + a*sin(3*x)^2 - 2*a*sin(3*x)*sin(x) + a*sin(x)^2)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.52 \[ \int \frac {\cot ^2(x)}{\sqrt {a+a \tan ^2(x)}} \, dx=-\frac {\tan \left (x\right )}{\sqrt {a \tan \left (x\right )^{2} + a}} + \frac {2 \, \sqrt {a}}{{\left (\sqrt {a} \tan \left (x\right ) - \sqrt {a \tan \left (x\right )^{2} + a}\right )}^{2} - a} \]

[In]

integrate(cot(x)^2/(a+a*tan(x)^2)^(1/2),x, algorithm="giac")

[Out]

-tan(x)/sqrt(a*tan(x)^2 + a) + 2*sqrt(a)/((sqrt(a)*tan(x) - sqrt(a*tan(x)^2 + a))^2 - a)

Mupad [B] (verification not implemented)

Time = 11.09 (sec) , antiderivative size = 40, normalized size of antiderivative = 1.29 \[ \int \frac {\cot ^2(x)}{\sqrt {a+a \tan ^2(x)}} \, dx=\frac {\sqrt {2}\,\left (6\,\sin \left (2\,x\right )-2\,\sin \left (2\,x\right )\,\left (2\,{\cos \left (x\right )}^2-1\right )\right )}{8\,\sqrt {a}\,\sqrt {2\,{\cos \left (x\right )}^2}\,\left ({\cos \left (x\right )}^2-1\right )} \]

[In]

int(cot(x)^2/(a + a*tan(x)^2)^(1/2),x)

[Out]

(2^(1/2)*(6*sin(2*x) - 2*sin(2*x)*(2*cos(x)^2 - 1)))/(8*a^(1/2)*(2*cos(x)^2)^(1/2)*(cos(x)^2 - 1))